package com.dflc.entity.rep;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Slf4j
public class HttpResponseEntity<T> {
    private int status; // HTTP状态码
    private String message; // 响应消息
    private T data; // 响应数据

    public static <T> HttpResponseEntity<T> success(T data) {
        return new HttpResponseEntity<>(200, "成功", data);
    }

    public static HttpResponseEntity<Void> error(int status, String message) {
        log.error(message);
        return new HttpResponseEntity<>(status, message, null);
    }
    public static <T> HttpResponseEntity<T> error2(int status, String message,T data) {
        return new HttpResponseEntity<>(status, message, data);
    }

}
